package com.onesports.intelligent.k12.polarlight.controller.organization.staff;

import com.onesports.framework.kit.common.valid.Json;
import com.onesports.intelligent.k12.polarlight.common.utils.ResultUtil;
import com.onesports.intelligent.k12.polarlight.constant.ApiPathConstants;
import com.onesports.intelligent.k12.polarlight.domain.dto.sys.PasswordChangeDTO;
import com.onesports.intelligent.k12.polarlight.domain.dto.sys.PersonalCenterUpdDTO;
import com.onesports.intelligent.k12.polarlight.domain.vo.sys.PersonalCenterDetailVO;
import com.onesports.intelligent.k12.polarlight.security.SecurityUtils;
import com.onesports.intelligent.k12.polarlight.service.sys.AccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @author zengzl
 */
@RequiredArgsConstructor
@RestController
@RequestMapping(ApiPathConstants.ORGANIZATION_PERSONAL_CENTER)
@Api(tags="个人中心")
@PreAuthorize("isAuthenticated()")
public class PersonalCenterController {
    private final AccountService accountService;

//    @GetMapping("/detail")
//    @ApiOperation("详情")
//    public ResponseEntity<PersonalCenterDetailVO> detail() {
//        return ResultUtil.success(this.accountService.detail(SecurityUtils.getAccountId()));
//    }

    @PostMapping("/upd-pwd")
    @ApiOperation("修改密码")
    public ResponseEntity<String> updPwd(@Json @RequestBody PasswordChangeDTO dto) {
        dto.setId(SecurityUtils.getAccountId());
        this.accountService.updatePwd(dto);
        return ResultUtil.success("修改成功");
    }

//    @PostMapping("/update")
//    @ApiOperation("修改资料")
//    public ResponseEntity<String> update(@Json @RequestBody PersonalCenterUpdDTO dto) {
//        this.accountService.updDetail(dto);
//        return ResultUtil.success("修改成功");
//    }
}
